<?php
  
   require "../../system/framework.php";    
   $excel = new excel();
   
   //column_table="page" href="excel_matrix" nm_table="" row_field="login" row_orderby="" row_table="user">excel_matrix</a></p>
   $excelData = array();
   
   $excelData[0][0] = "";
   
   
   // Column
   $dataColumn = new data();
   $dataColumn->getTable("[php_property:column_table]");
   $n=1;
   do {
       //$excelData[0][$n] = $dataColumn->data['[php_property:column_field]'];
       $excelData[0][$n] = $dataColumn->getMultiData('[php_property:column_field]');
       $n++;
   } while($dataColumn->nextRow());
   
   
  // print_r($excelData);
   
   // Row
   $dataRow = new data();
   $dataRow->getTable("[php_property:row_table]");
   $n=1;
   do {
       //$excelData[$n][0] = $dataRow->data['[php_property:row_field]'];
      $excelData[$n][0] = $dataRow->getMultiData('[php_property:row_field]');
       
    //   echo "row";
       
                                                  // LEFT
     $sql="SELECT * FROM [php_property:column_table] LEFT JOIN 
    (SELECT * FROM [php_property:nm_table] WHERE _[php_property:row_table]=".$dataRow->data['id']. ") a 
     ON [php_property:column_table].id=_[php_property:column_table]";
     
    // echo $sql;
       
     $dataNm = new data();
     $dataNm->getQuery($sql);

    // echo "row";
       
       $m= 1;
       do {
           
           //echo "col";
           
            if (!is_null($dataNm->data['_[php_property:row_table]'])) {
                  
                //echo "X ( $m,$n )";
                
                $excelData[$n][$m] = "x";
            } else {
                $excelData[$n][$m] = "";
                
            }
            $m++;
           
           
       }while($dataNm->nextRow());
       
       $n++;
       
   } while($dataRow->nextRow());
   
   
           
          
   //print_r($excelData);            
   
   $excel->createExcelDocument($excelData);
  
?>
